<?php
class Settings {
	function setAll($title, $keywords, $description) {
		if ($title != "") {
			self::setTitle($title);
		}
		if ($keywords != "") {
			self::setKeywords($keywords);
		}
		if ($description != "") {
			self::setDescription($description);
		}
	}
	
	function setTitle($title) {
		$title = MySQLData($title);
		$sql = "UPDATE settings SET value = '$title' WHERE name = 'title' LIMIT 1";
		mysql_query($sql);
	}
	
	function get($what) {
		$sql = "SELECT value FROM settings WHERE name = '$what'";
		$ps = mysql_query($sql);
		while ($a = mysql_fetch_row($ps)){
			return $a[0];
		}
	}
	
	function getTitle() {
		$sql = "SELECT value FROM settings WHERE name = 'title'";
		$ps = mysql_query($sql);
		while ($a = mysql_fetch_row($ps)){
			return $a[0];
		}
	}
	
	function setKeywords($keywords) {
		$keywords = MySQLData($keywords);
		$sql = "UPDATE settings SET value = '$keywords' WHERE name = 'keywords' LIMIT 1";
		mysql_query($sql);
	}
	
	function getKeywords() {
		$sql = "SELECT value FROM settings WHERE name = 'keywords'";
		$ps = mysql_query($sql);
		while ($a = mysql_fetch_row($ps)){
			return $a[0];
		}
	}
	
	function getStrankovani() {
		$sql = "SELECT value FROM settings WHERE name = 'strankovani'";
		$ps = mysql_query($sql);
		while ($a = mysql_fetch_row($ps)){
			return $a[0];
		}
	}
	
	function setDescription($description) {
		$description = MySQLData($description);
		$sql = "UPDATE settings SET value = '$description' WHERE name = 'description' LIMIT 1";
		mysql_query($sql);
	}
	
	function getDescription() {
		$sql = "SELECT value FROM settings WHERE name = 'description'";
		$ps = mysql_query($sql);
		while ($a = mysql_fetch_row($ps)){
			return $a[0];
		}
	}	
}
?>